#include <stdlib.h>
#include <stdio.h>

typedef int Status;
typedef int QElemType;
typedef struct QNode
{
    QElemType data;
    struct QNode *next;
}QNode, *QueuePtr;
typedef struct
{
    QueuePtr front;
    QueuePtr rear;
}LinkQueue;

Status InitQueue(LinkQueue *Q);
Status EnQueue(LinkQueue *Q, QElemType e);
Status DeQueue(LinkQueue *Q, QElemType *e);
int Capture (LinkQueue *Q, int Len, int N, int Cnt);

int main()
{
    int n, m, i;
    scanf("%d %d", &n, &m);
    LinkQueue * queue = (LinkQueue *)malloc(sizeof(LinkQueue));
    InitQueue(queue);
    for (i = 1; i <= n; i++)
        EnQueue(queue, i);
    for (i = 0; i < m; i++)
    {
        int len;
        scanf("%d", &len);
        printf("%d\n", Capture(queue, len, n, i));
    }
    
    return 0;
    
}


/* 请在这里填写答案 */
Status InitQueue(LinkQueue *Q)
{
    Q->front=NULL;
    Q->rear=NULL;
    return 1;
}
Status EnQueue(LinkQueue *Q, QElemType e)
{
    QueuePtr ans=malloc(sizeof (QNode));
    ans->data=e;
    if(!Q->rear)
    {
        Q->rear=Q->front=ans;
        ans->next=NULL;
    }
    else
    {
        Q->rear->next=ans;
        Q->rear=ans;
        ans->next=Q->front;
    }
    return 1;
}
int Capture (LinkQueue *Q, int Len, int N, int Cnt)
{
    Len%=N-Cnt;
    Len+=N-Cnt;
    for(int i=1;i<Len;Q->rear=Q->rear->next,++i);
    int fish=Q->rear->next->data;
    Q->rear->next=Q->rear->next->next;
    return  fish;
}
